package com.day20;

public class Test2 {
    public static void main(String[] args) {
        int[][] array1={//第一种初始化方式
                {1,2,3,4,5},
                {6,7,8,9,10},
                {11,12,13,14,15},
                {16,17,18,19,20},
                {21,22,23,25,25}
        };

        //第二种初始化方式
        int[][] array2=new int[5][5];
        int count=0;
        //使用双重循环赋值
        for (int i=0;i<array2.length;i++){
            for (int j=0;j<array2[i].length;j++){
                array2[i][j]=count++;
            }
        }

        //遍历array1
        System.out.println("遍历array1");
        for (int i=0;i<array1.length;i++){
            for (int s=0;s<array1[i].length;s++){
                System.out.print(array1[i][s]+" ");
            }
            System.out.println();
        }

        //遍历array2
        System.out.println("遍历array2");
        for (int i=0;i<array2.length;i++){
            for (int s=0;s<array2[i].length;s++){
                System.out.print(array2[i][s]+" ");
            }
            System.out.println();
        }
    }
}
